<?php
include("db/connect.php");
$output_dir = iconv("UTF-8","TIS-620","img/รูปโปรเจค/");
if(isset($_FILES["pro_picture"]))
{
    //Filter the file types , if you want.
    if ($_FILES["pro_picture"]["error"] > 0)
    {
      //echo "Error: " . $_FILES["file"]["error"] . "<br>";
    }
    else
    {
	$nameimg=iconv("UTF-8","TIS-620",$_FILES["pro_picture"]["name"]);
	echo $nameimg;
        //move the uploaded file to uploads folder;
        move_uploaded_file($_FILES["pro_picture"]["tmp_name"],$output_dir. date("Y-m-d").$nameimg);
$sqlinsert_product="INSERT INTO product";
$sqlinsert_product.="(pro_name,pro_price,pro_picture,pro_detail)";
$sqlinsert_product.=" VALUES('".$_POST["pro_name"]."','".$_POST["pro_price"]."','".$_POST["pro_picture"]."','".$_POST["pro_detail"]."')";
$queryinsertproduct=mysql_query($sqlinsert_product);
	}
}
?>